Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cookie-storage

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cookie-storage

A Web Storage interface for Cookie

  • 6.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

cookie-storage

cookie-storage: A Web Storage interface for Cookie.

Storage interface spec.

Installation

$ npm install cookie-storage

Usage

import { CookieStorage } from 'cookie-storage';

const cookieStorage = new CookieStorage();

cookieStorage.length === 0;
cookieStorage.getItem('key') === null;

cookieStorage.setItem('key', 'value');
cookieStorage.length === 1;
cookieStorage.key(0) === 'key';

cookieStorage.getItem('key') === 'value';
cookieStorage.removeItem('key');
cookieStorage.length === 0;

cookieStorage.setItem('k1', 'v1');
cookieStorage.setItem('k2', 'v2');
cookieStorage.length === 2;

cookieStorage.clear();
cookieStorage.length === 0;

// Cookie options
cookieStorage.setItem('key', 'value', {
  path: '/',
  domain: 'example.com',
  expires: new Date(),
  secure: true,
  sameSite: 'Strict' // Can be 'Strict' or 'Lax'.
});

// Use default cookie options
const storage = new CookieStorage({
  path: '/',
  domain: 'example.com',
  expires: new Date(),
  secure: true,
  sameSite: 'Strict' // Can be 'Strict' or 'Lax'.
});
storage.setItem('key', 'value'); // ;path=/;domain=example.com;...

Development

$ npm install
$ npm run watch

Badges

NPM Travis CI

License

MIT

Contributors

Author

bouzuya <m@bouzuya.net> (http://bouzuya.net)

Keywords

FAQs

Package last updated on 07 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc